package core.web.easyui;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class TreeNode {

//	id: 节点ID，这是很重要的加载远程数据 
//	text: 文字显示节点 
//	state: 节点的状态，“开放”或“关闭”，默认为“打开”。 当设置为“关闭”，该节点有子节点，并将它们远程加载 
//	checked: 指示节点是否被选中选中. 
//	attributes: 自定义属性可以被添加到一个节点 
//	children: 一个数组节点有一些子节点 
	
//	[{
//	    "id":1,
//	    "text":"Folder1",
//	    "iconCls":"icon-save",
//	    "children":[{
//	        "text":"File1",
//	        "checked":true
//	    },{
//	        "text":"Books",
//	        "state":"open",
//	        "attributes":{
//	            "url":"/demo/book/abc",
//	            "price":100
//	        },
//	        "children":[{
//	            "text":"PhotoShop",
//	            "checked":true
//	        },{
//	            "id": 8,
//	            "text":"Sub Bookds",
//	            "state":"closed"
//	        }]
//	    }]
//	},{
//	    "text":"Languages",
//	    "state":"closed",
//	    "children":[{
//	        "text":"Java"
//	    },{
//	        "text":"C#"
//	    }]
//	}]
	
	
	private String id;
	
	private String text;
	
	private String state="open";
	
	private boolean checked;
	
	private List<Map<String, Object>> attributes=new ArrayList<Map<String,Object>>();
	
	List<TreeNode> children=new ArrayList<TreeNode>();
	
	
	
	
	public TreeNode() {
		super();
	}

	public TreeNode(String id, String text) {
		super();
		this.id = id;
		this.text = text;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}


	public boolean isChecked() {
		return checked;
	}

	public void setChecked(boolean checked) {
		this.checked = checked;
	}

	public List<Map<String, Object>> getAttributes() {
		return attributes;
	}

	public void setAttributes(List<Map<String, Object>> attributes) {
		this.attributes = attributes;
	}

	public List<TreeNode> getChildren() {
		return children;
	}

	public void setChildren(List<TreeNode> children) {
		this.children = children;
	}
	
	
	public void addTreeNode(TreeNode treeNode) {
		children.add(treeNode);
	}
	
	public void addattribute(Map<String, Object> map) {
		attributes.add(map);
	}	
	
}
